# GCC, the GNU Compiler Collection
CC := gcc
CXX := g++
LD := g++
AS := gas
AR := ar
RM := rm
CFLAGS := -c -g -O0
LDFLAGS :=
LIB_DIR := libs
INCLUDES := -Isrc/core/inc -Isrc/platforms/posix/inc

SRCS = src/core/src/Handler.c \
	src/core/src/Message.c \
	src/core/src/MessageQueue.c \
	src/core/src/Looper.c \
	src/core/src/AsyncResult.c \
	src/core/src/Registrant.c \
	src/core/src/MessagePool.c \
	src/core/src/ArrayList.c \
	src/core/src/RegistrantList.c \
	src/platforms/posix/src/Lock.c \
	src/platforms/posix/src/Signal.c \
	src/platforms/posix/src/ThreadLocal.c \

OBJS = $(SRCS:.c=.o)

LIB_OBJS = $(addprefix $(LIB_DIR)/,$(OBJS))

MsgHandler = $(LIB_DIR)/libmsghandler.a


.PHONY: clean

all: $(MsgHandler)

$(MsgHandler): $(LIB_OBJS)
	$(AR) -r $@ $^

$(LIB_DIR)/%.o: %.c
	@mkdir -p $(@D)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

clean:
	$(RM) -rf $(LIB_DIR)
